<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={{$baidukey}}"></script>
    <link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
    <title>{{$result->name}}</title>
</head>
<body>
<div class="big-map-div">
    <div id="big-allmap"></div>
    <div id="r-result"></div>
</div>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("big-allmap");
    // 创建地址解析器实例
    var myGeo = new BMap.Geocoder();
    // 将地址解析结果显示在地图上,并调整地图视野
    var sContent = '<div style="margin:0;line-height:20px;padding:10px 5px;">' +
        '<h4 style="margin:0 0 5px 0;padding:5px">{{$result->name}}</h4>' +
        '地址：{{$result->address}}<br/>电话：{{$result->telphone}}' +
        '</div>';
    myGeo.getPoint("{{$result->address}}", function(point){
        if (point) {
            var marker = new BMap.Marker(point);
            map.centerAndZoom(point, 18);
            map.addOverlay(marker);  // 将标注添加到地图中
            var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象
            marker.addEventListener("click", function(){
                this.openInfoWindow(infoWindow);
            });
        }else{
            alert("您选择地址没有解析到结果!");
        }
    }, "");
</script>
</body>
</html>